package partitioner;

import org.apache.flink.api.common.functions.Partitioner;

/**
 * Create by zhh on 2022/9/6.
 */
public class ZHPartitioner implements Partitioner<String> {
    @Override
    public int partition(String key, int numPartition) {
        System.out.println("分区数："+numPartition);
        if ("cai.com".equals(key)){
            return 0;
        }else if ("baidu.com".equals(key)){
            return 1;
        }else {
            return 2;
        }

    }
}
